package cn.liufuwen.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import cn.liufuwen.entity.UserDTO;

@RestController
public class IndexController {
	@RequestMapping("/")
    public ModelAndView index(ModelAndView modelAndView,HttpSession session) {
		UserDTO userDTO = (UserDTO)session.getAttribute("USER_SESSION_KEY");
	    
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("username", userDTO.getUsername());
		modelAndView.setViewName("index");
		modelAndView.addAllObjects(map);
		return modelAndView;
	}
}
